package de.negativrekord.blockworld.geometry;

import cc.creativecomputing.math.CCMath;
import cc.creativecomputing.math.CCVector3f;

public class BlockCreatorPresets extends BlockCreator {
	
	public BlockCreatorPresets (int nVertices) {
		super (nVertices);
	}
	
	public void preset (int thePreset) {
		
		if (thePreset==0) {
			for (int i=0; i<200; i++) {
				addBox ((int)CCMath.random(-1500,1500),0,(int)CCMath.random(-1500,1500),400,(int)CCMath.random(100,300));
			}
			for (int i=0; i<50; i++) {
				addBox ((int)CCMath.random(-1500,1500),0,(int)CCMath.random(-1500,1500),(int)CCMath.random(100,200),(int)CCMath.random(300,400));
			}
			
			for (int i=0; i<50; i++) {
				addBox ((int)CCMath.random(-1500,1500),0,(int)CCMath.random(-1500,1500),50,(int)CCMath.random(400,500));
			}
		}
		
		if (thePreset==1) {
			for (int i=0; i<6000; i++) {
				int x = (int)CCMath.random(-8000,8000);
				int z = (int)CCMath.random(-8000,8000);
				
				float d = CCMath.sq(CCMath.dist(x, z, 0, 0));
				addBox (x,0,z, 50, (int)d/10000);
			}
			for (int i=0; i<40; i++) {
				addBox ((int)CCMath.random(-1500,1500),0,(int)CCMath.random(-1500,1500),400,(int)CCMath.random(100,300));
				addBox ((int)CCMath.random(-1500,1500),0,(int)CCMath.random(-1500,1500),200,(int)CCMath.random(300,500));
			}
			addBox (0,0,0,8000,200);
		}
		
		if (thePreset==2) {
			addBox (0,0,0,8000,1000);
			
			
			for (int i=0; i<40000; i++) {
				CCVector3f pos = new CCVector3f(CCMath.random(-1000,1000),CCMath.random(-1000,1000),CCMath.random(-1000,1000));
				float d = pos.distance(new CCVector3f(0,0,0))/100; 
				addBox ((int)pos.x, (int)pos.y, (int)pos.z,1,(int)(CCMath.sin(pos.x*0.01f)*10+10));
			}
		}
		
		if (thePreset==3) {
			int size0 = 200;
			addBox (0,0,0,size0,size0);
			
			/*
			int size1 = 200;
			for (int i=0; i<size0/size1; i++) {
				for (int j=0; j<size0/size1; j++) {
					addBox (-size0/2+i*size1,-size0/2,-size0/2+j*size1, (int)CCMath.random(0,200),(int)CCMath.random(0,1000));
					addBox (-size0/2+i*size1, size0/2,-size0/2+j*size1, (int)CCMath.random(0,200),(int)CCMath.random(0,1000));
				}
			}
			
			for (int i=0; i<size0/size1; i++) {
				for (int j=0; j<size0/size1; j++) {
					addBox (-size0/2,-size0/2+i*size1,-size0/2+j*size1, (int)CCMath.random(0,400),(int)CCMath.random(0,600));
					addBox (size0/2,-size0/2+i*size1,-size0/2+j*size1, (int)CCMath.random(0,400),(int)CCMath.random(0,600));
				}
			}
			
			for (int i=0; i<size0/size1; i++) {
				for (int j=0; j<size0/size1; j++) {
					addBox (-size0/2+j*size1,-size0/2+i*size1,-size0/2, (int)CCMath.random(0,200),(int)CCMath.random(0,200));
					addBox (-size0/2+j*size1,-size0/2+i*size1, size0/2, (int)CCMath.random(0,200),(int)CCMath.random(0,200));
				}
			}
			*/
		}
	}
}
